<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>My JSP 'edit_sys_user_info.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="${ctx }/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="${ctx }/css/font-awesome.css?v=4.4.0" rel="stylesheet">

<!-- jqgrid-->
<link href="${ctx }/css/plugins/jqgrid/ui.jqgrid.css?0820"
	rel="stylesheet">

<link href="${ctx }/css/animate.css" rel="stylesheet">
<link href="${ctx }/css/style.css?v=4.1.0" rel="stylesheet">
<style type="text/css">
body {
	background: none;
}
</style>
</head>
<body>

<div class="inmodal"  role="dialog" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content animated bounceInRight">
			<div class="modal-header">
					<button type="button" class="close closeWin" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
					</button>
					<h5 class="modal-title">修改部门</h5>
				</div>
				<div class="ibox-content">
					<form class="form-horizontal m-t" name="editSysOrgFrom" id="editSysOrgFrom">
						<input type="hidden" name="org_id" id="org_id" value="${sysOrgInfo.org_id }">
						<input type="hidden" name="parent_org_id" id="parent_org_id" value="${sysOrgInfo.parent_org_id }">
						
						<div class="form-group">
                        	<label class="col-sm-3 control-label">父级部门名称：</label>
                            <div class="col-sm-8">
                            	<input id="parent_name" name="parent_name" class="form-control" required="" 
                            	aria-required="true" type="text" value="${sysOrgInfo.parent_name }" readOnly="true">                                    
                            </div>
                        </div>
                        <div class="form-group">
                        	<label id="point_name" class="col-sm-3 control-label">部门名称：</label>
                            <div class="col-sm-8">
                            	<input id="org_name" name="org_name" class="form-control" required="" 
                            	aria-required="true" type="text" value="${sysOrgInfo.org_name }" placeholder="请输入部门名称">                                    
                            </div>
                        </div>
                        <div class="form-group">
                        	<label class="col-sm-3 control-label">部门级别：</label>
                            <div class="col-sm-8">
                            	<input id="org_order" value="${sysOrgInfo.org_order }" name="org_order" class="form-control" required="" 
                            	aria-required="true" type="number"  placeholder="请输入部门级别">                                    
                            </div>
                        </div>
						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-3">                                   
                                    <button type="button" class="btn btn-white closeWin" data-dismiss="modal">关闭</button>
                					<button type="submit"  class="btn btn-primary">保存</button>
                            </div>
                   		</div>
					</form>
				</div>
		</div>
	</div>
</div>
<!-- 全局js -->
<script src="${ctx }/js/jquery.min.js?v=2.1.4"></script>
<script src="${ctx }/js/bootstrap.min.js?v=3.3.6"></script>

<!-- Peity -->
<script src="${ctx }/js/plugins/peity/jquery.peity.min.js"></script>

<!-- jqGrid -->
<script src="${ctx }/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
<script src="${ctx }/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>

<!-- jQuery Validation plugin javascript-->
<script src="${ctx }/js/plugins/validate/jquery.validate.min.js"></script>
<script src="${ctx }/js/plugins/validate/messages_zh.min.js"></script>

<!-- layer javascript -->
<script src="${ctx }/js/plugins/layer/layer.min.js"></script>

<!-- jQuery form-->
<script src="${ctx }/js/jquery.form.js"></script>

<!-- 自定义js ---->
<script src="${ctx }/js/content.js?v=1.0.0"></script>
<script src="${ctx }/js/plugins/layer/laydate/laydate.js"></script>
<script type="text/javascript">
	var val=$("#level").val();
	changeLevel(val);
    	
    	//changeLevel('1');//默认不是揽件员
   	function changeLevel(value){
   		//console.log();
   		if(value=='0'){
   			$("#point_name").text("网点名称：");
   			$("#responsible_person").parent().parent().show();
   			$("#responsible_person").attr("required","");
   			$("#longitude").parent().parent().show();
   			$("#longitude").attr("required","");
   			$("#latitude").attr("required","");
   			$("#phone_number").parent().parent().show();
   			$("#phone_number").attr("required","");
   			$("#address").parent().parent().show();
   			$("#address").attr("required","");
   			
   		}else{
   			$("#point_name").text("部门名称：");
   			$("#responsible_person").parent().parent().hide();
   			$("#responsible_person").removeAttr("required");
   			$("#longitude").parent().parent().hide();
   			$("#longitude").removeAttr("required");
   			$("#latitude").removeAttr("required");
   			$("#phone_number").parent().parent().hide();
   			$("#phone_number").removeAttr("required");
   			$("#address").parent().parent().hide();
   			$("#address").removeAttr("required");
   			
   		}
   	}
	/* $(document).ready(function() {

		$.jgrid.defaults.styleUI = 'Bootstrap';
		
	}); */
	//绑定修改表单提交事件,异步提交表单
	$('.closeWin').click(function() {
		//alert("111");
		window.parent.editOrgWinClose('1');
	});
	$("#editSysOrgFrom").submit(function(){
		
		$.ajax({
			type : "post",
			url : "${ctx }/organize/doEditSysOrg",
			data : $('#editSysOrgFrom').serialize(),
			datatype : "json",
			success : function(data) {
				debugger;
				//console.log(data.status);
				//window.parent.editOrgWinClose('0');
				 if (data.status == '0') {
					layer.alert("保存成功", {
						icon : 1
					}, function(index) {
						
						window.parent.editOrgWinClose('0');
						//关闭提示框
						//layer.close(index);
					});
				} else {
					layer.alert("保存失败！", {
						icon : 2
					});
				}  
			}
		});
		
		return false;
	}); 
	
	 
	 function getjwd(){
        	layer.open({
  				type: 2,
			  	 shadeClose: true,
      			shade: false,
      			maxmin: true, //开启最大化最小化按钮
      			area: ['580px', '500px'],
			  	content: '${ctx }/organize/toMap' //iframe的url
			});
        }
        
        function putJwd(lng,lat){
        	$("#longitude").val(lng);
        	$("#latitude").val(lat);
        }
</script>
</body>
</html>
